<!DOCTYPE html>
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
  <meta name="description" content="刘清政">
  <meta name="keyword" content="hexo-theme">
  
    <link rel="shortcut icon" href="/css/images/logo.png">
  
  <title>
    
      Justin-刘清政的博客
    
  </title>
  <link href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
  <link href="//cdnjs.cloudflare.com/ajax/libs/nprogress/0.2.0/nprogress.min.css" rel="stylesheet">
  <link href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/tomorrow.min.css" rel="stylesheet">
  
<link rel="stylesheet" href="/css/style.css">

  
    
<link rel="stylesheet" href="/css/plugins/gitment.css">

  
  <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  <script src="//cdnjs.cloudflare.com/ajax/libs/geopattern/1.2.3/js/geopattern.min.js"></script>
  <script src="//cdnjs.cloudflare.com/ajax/libs/nprogress/0.2.0/nprogress.min.js"></script>
  
    
<script src="/js/qrious.js"></script>

  
  
    
<script src="/js/gitment.js"></script>

  
  

  
<meta name="generator" content="Hexo 4.2.0"></head>
<div class="wechat-share">
  <img src="/css/images/logo.png" />
</div>

  <body>
    <header class="header fixed-header">
  <div class="header-container">
    <a class="home-link" href="/">
      <div class="logo"></div>
      <span>Justin-刘清政的博客</span>
    </a>
    <ul class="right-list">
      
        <li class="list-item">
          
            <a href="/" class="item-link active">主页</a>
          
        </li>
      
        <li class="list-item">
          
            <a href="/tags/" class="item-link">标签</a>
          
        </li>
      
        <li class="list-item">
          
            <a href="/archives/" class="item-link">归档</a>
          
        </li>
      
        <li class="list-item">
          
            <a href="/about/" class="item-link">关于我</a>
          
        </li>
      
    </ul>
    <div class="menu">
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
    </div>
    <div class="menu-mask">
      <ul class="menu-list">
        
          <li class="menu-item">
            
              <a href="/" class="menu-link mobile-active">主页</a>
            
          </li>
        
          <li class="menu-item">
            
              <a href="/tags/" class="menu-link">标签</a>
            
          </li>
        
          <li class="menu-item">
            
              <a href="/archives/" class="menu-link">归档</a>
            
          </li>
        
          <li class="menu-item">
            
              <a href="/about/" class="menu-link">关于我</a>
            
          </li>
        
      </ul>
    </div>
  </div>
</header>

    <main class="app-body">
  
    <article class="article-card">
      <h2 class="article-head">
        <a href="/python/%E5%B8%B8%E7%94%A8%E6%A8%A1%E5%9D%97/4-os%E6%A8%A1%E5%9D%97/">python/常用模块/4-os模块</a>
      </h2>
      <p class="article-date">2020年12月21日</p>
      
      <div class="article-summary">
        
          一、os模块os模块负责程序与操作系统的交互，提供了访问操作系统底层的接口，多用于文件处理。



方法
详解



os.getcwd()
获取当前工作目录，即当前python脚本工作的目录路径


os.chdir(“dirname”)
改变当前脚本工作目录；相当于shell下cd


 ...
        
      </div>
      <a class="more" href="/python/%E5%B8%B8%E7%94%A8%E6%A8%A1%E5%9D%97/4-os%E6%A8%A1%E5%9D%97/">详情...</a>
    </article>
  
    <article class="article-card">
      <h2 class="article-head">
        <a href="/python/%E5%B8%B8%E7%94%A8%E6%A8%A1%E5%9D%97/20-ATM+%E8%B4%AD%E7%89%A9%E8%BD%A6%E9%A1%B9%E7%9B%AE/">python/常用模块/20-ATM+购物车项目</a>
      </h2>
      <p class="article-date">2020年12月21日</p>
      
      <div class="article-summary">
        
          功能需求12345678910111213FUNC_MSG &#x3D; &#123;    &#39;0&#39;: &#39;注销&#39;,    &#39;1&#39;: &#39;登录&#39;,    &#39;2&#39;: &#39;注册&#39;,    &#39;3&#3 ...
        
      </div>
      <a class="more" href="/python/%E5%B8%B8%E7%94%A8%E6%A8%A1%E5%9D%97/20-ATM+%E8%B4%AD%E7%89%A9%E8%BD%A6%E9%A1%B9%E7%9B%AE/">详情...</a>
    </article>
  
    <article class="article-card">
      <h2 class="article-head">
        <a href="/python/%E5%B8%B8%E7%94%A8%E6%A8%A1%E5%9D%97/6-json%E5%92%8Cpickle%E6%A8%A1%E5%9D%97/">python/常用模块/6-json和pickle模块</a>
      </h2>
      <p class="article-date">2020年12月21日</p>
      
      <div class="article-summary">
        
          一、json和pickle模块1.1 序列化把对象(变量)从内存中变成可存储或传输的过程称之为序列化，在Python中叫pickling，在其他语言中也被称之为serialization，marshalling，flattening。
序列化的优点：

持久保存状态：内存是无法永久保存数据的 ...
        
      </div>
      <a class="more" href="/python/%E5%B8%B8%E7%94%A8%E6%A8%A1%E5%9D%97/6-json%E5%92%8Cpickle%E6%A8%A1%E5%9D%97/">详情...</a>
    </article>
  
    <article class="article-card">
      <h2 class="article-head">
        <a href="/python/%E5%B8%B8%E7%94%A8%E6%A8%A1%E5%9D%97/10-pandas%E6%A8%A1%E5%9D%97/">python/常用模块/10-pandas模块</a>
      </h2>
      <p class="article-date">2020年12月21日</p>
      
      <div class="article-summary">
        
          pandas官方文档：https://pandas.pydata.org/pandas-docs/stable/?v=20190307135750
pandas基于Numpy，可以看成是处理文本或者表格数据。pandas中有两个主要的数据结构，其中Series数据结构类似于Numpy中的一维 ...
        
      </div>
      <a class="more" href="/python/%E5%B8%B8%E7%94%A8%E6%A8%A1%E5%9D%97/10-pandas%E6%A8%A1%E5%9D%97/">详情...</a>
    </article>
  
    <article class="article-card">
      <h2 class="article-head">
        <a href="/python/%E5%B8%B8%E7%94%A8%E6%A8%A1%E5%9D%97/5-sys%E6%A8%A1%E5%9D%97/">python/常用模块/5-sys模块</a>
      </h2>
      <p class="article-date">2020年12月21日</p>
      
      <div class="article-summary">
        
          一、sys模块sys模块负责程序与python解释器的交互，提供了一系列的函数和变量，用于操控python的运行时环境。



方法
详解



sys.argv
命令行参数List，第一个元素是程序本身路径


sys.modules.keys()
返回所有已经导入的模块列表


sys. ...
        
      </div>
      <a class="more" href="/python/%E5%B8%B8%E7%94%A8%E6%A8%A1%E5%9D%97/5-sys%E6%A8%A1%E5%9D%97/">详情...</a>
    </article>
  
    <article class="article-card">
      <h2 class="article-head">
        <a href="/python/%E5%B8%B8%E7%94%A8%E6%A8%A1%E5%9D%97/3-random%E6%A8%A1%E5%9D%97/">python/常用模块/3-random模块</a>
      </h2>
      <p class="article-date">2020年12月21日</p>
      
      <div class="article-summary">
        
          一、random模块1import random

12# 大于0且小于1之间的小数print(random.random())

10.42866657593385415

12# 大于等于1且小于等于3之间的整数print(random.randint(1, 3))

13

12# 大 ...
        
      </div>
      <a class="more" href="/python/%E5%B8%B8%E7%94%A8%E6%A8%A1%E5%9D%97/3-random%E6%A8%A1%E5%9D%97/">详情...</a>
    </article>
  
    <article class="article-card">
      <h2 class="article-head">
        <a href="/python/%E5%B8%B8%E7%94%A8%E6%A8%A1%E5%9D%97/19-python%E5%B8%B8%E7%94%A8%E6%A8%A1%E5%9D%97%E5%B0%8F%E7%BB%93/">python/常用模块/19-python常用模块小结</a>
      </h2>
      <p class="article-date">2020年12月21日</p>
      
      <div class="article-summary">
        
          一、Python常用模块小结1.1 time模块
打印三种不同形式的时间,时间戳/格式化时间/结构化时间

1.2 datetime模块
时间的加减

1.3 random模块
随机数

1.4 os模块
与操作系统交互,多用于文件操作

1.5 sys模块
与python解释器交互,多用于 ...
        
      </div>
      <a class="more" href="/python/%E5%B8%B8%E7%94%A8%E6%A8%A1%E5%9D%97/19-python%E5%B8%B8%E7%94%A8%E6%A8%A1%E5%9D%97%E5%B0%8F%E7%BB%93/">详情...</a>
    </article>
  
    <article class="article-card">
      <h2 class="article-head">
        <a href="/python/%E5%B8%B8%E7%94%A8%E6%A8%A1%E5%9D%97/2-datetime%E6%A8%A1%E5%9D%97/">python/常用模块/2-datetime模块</a>
      </h2>
      <p class="article-date">2020年12月21日</p>
      
      <div class="article-summary">
        
          一、datetime模块12# datetime模块可以看成是时间加减的模块import datetime

12# 返回当前时间print(datetime.datetime.now())

12019-03-07 16:22:14.544130

1print(datetime.date ...
        
      </div>
      <a class="more" href="/python/%E5%B8%B8%E7%94%A8%E6%A8%A1%E5%9D%97/2-datetime%E6%A8%A1%E5%9D%97/">详情...</a>
    </article>
  
    <article class="article-card">
      <h2 class="article-head">
        <a href="/python/%E5%B8%B8%E7%94%A8%E6%A8%A1%E5%9D%97/17-xml%E6%A8%A1%E5%9D%97/">python/常用模块/17-xml模块</a>
      </h2>
      <p class="article-date">2020年12月21日</p>
      
      <div class="article-summary">
        
          一、xml简介xml是实现不同语言或程序之间进行数据交换的协议，跟json差不多，但json使用起来更简单，不过，古时候，在json还没诞生的黑暗年代，大家只能选择用xml呀，至今很多传统公司如金融行业的很多系统的接口还主要是xml。
xml的格式如下，就是通过&lt;&gt;节点来区别数据 ...
        
      </div>
      <a class="more" href="/python/%E5%B8%B8%E7%94%A8%E6%A8%A1%E5%9D%97/17-xml%E6%A8%A1%E5%9D%97/">详情...</a>
    </article>
  
    <article class="article-card">
      <h2 class="article-head">
        <a href="/python/%E5%B8%B8%E7%94%A8%E6%A8%A1%E5%9D%97/18-subprocess%E6%A8%A1%E5%9D%97/">python/常用模块/18-subprocess模块</a>
      </h2>
      <p class="article-date">2020年12月21日</p>
      
      <div class="article-summary">
        
          一、subprocess模块subprocess模块允许你去创建一个新的进程让其执行另外的程序，并与它进行通信，获取标准的输入、标准输出、标准错误以及返回码等。更多查看官网：https://docs.python.org/2/library/subprocess.html?highlight ...
        
      </div>
      <a class="more" href="/python/%E5%B8%B8%E7%94%A8%E6%A8%A1%E5%9D%97/18-subprocess%E6%A8%A1%E5%9D%97/">详情...</a>
    </article>
  

  
    <div class="guide-pager">
  
    <a href="/"><span class="page-arrow">← </span>Prev</a>
  
  
    <a href="/page/3/">Next<span class="page-arrow"> →</span></a>
  
</div>
  
</main>


    <div class="scroll-top">
  <span class="arrow-icon"></span>
</div>
    <footer class="app-footer">
<!-- 不蒜子统计 -->
<span id="busuanzi_container_site_pv">
     本站总访问量<span id="busuanzi_value_site_pv"></span>次
</span>
<span class="post-meta-divider">|</span>
<span id="busuanzi_container_site_uv" style='display:none'>
     本站访客数<span id="busuanzi_value_site_uv"></span>人
</span>
<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>



  <p class="copyright">
    &copy; 2021 | Proudly powered by <a href="https://www.cnblogs.com/xiaoyuanqujing" target="_blank">小猿取经</a>
    <br>
    Theme by <a href="https://www.cnblogs.com/xiaoyuanqujing" target="_blank" rel="noopener">小猿取经</a>
  </p>
</footer>

<script>
  function async(u, c) {
    var d = document, t = 'script',
      o = d.createElement(t),
      s = d.getElementsByTagName(t)[0];
    o.src = u;
    if (c) { o.addEventListener('load', function (e) { c(null, e); }, false); }
    s.parentNode.insertBefore(o, s);
  }
</script>
<script>
  async("//cdnjs.cloudflare.com/ajax/libs/fastclick/1.0.6/fastclick.min.js", function(){
    FastClick.attach(document.body);
  })
</script>

<script>
  var hasLine = 'true';
  async("//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js", function(){
    $('figure pre').each(function(i, block) {
      var figure = $(this).parents('figure');
      if (hasLine === 'false') {
        figure.find('.gutter').hide();
      }
      var lang = figure.attr('class').split(' ')[1] || 'code';
      var codeHtml = $(this).html();
      var codeTag = document.createElement('code');
      codeTag.className = lang;
      codeTag.innerHTML = codeHtml;
      $(this).attr('class', '').empty().html(codeTag);
      figure.attr('data-lang', lang.toUpperCase());
      hljs.highlightBlock(block);
    });
  })
</script>





<!-- Baidu Tongji -->

<script>
    var _baId = 'c5fd96eee1193585be191f318c3fa725';
    // Originial
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "//hm.baidu.com/hm.js?" + _baId;
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
</script>


<script src="/js/script.js"></script>


<script src="/js/search.js"></script>


<script src="/js/load.js"></script>



  <span class="local-search local-search-google local-search-plugin" style="right: 50px;top: 70px;;position:absolute;z-index:2;">
      <input type="search" placeholder="站内搜索" id="local-search-input" class="local-search-input-cls" style="">
      <div id="local-search-result" class="local-search-result-cls"></div>
  </span>


  </body>
</html>